package de.metalcon.gwt.client.modules;

import java.util.ArrayList;
import java.util.Map;
import java.util.Map.Entry;

import com.google.gwt.user.client.ui.CaptionPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;

import de.metalcon.gwt.client.mainDesign.Box;
import de.metalcon.gwt.client.mainDesign.MainContent;
import de.metalcon.gwt.shared.ContentTransmitter;

public class MySQLModule extends ADynamicModule {
	public MySQLModule() {
		addReuqestVar("RequestVarKey", "RequestVarValue");
	}

	@Override
	protected void generateContent() {
		ContentTransmitter transmitter = getContentTransmitter();
		Box box = new Box();
		add(box);

		for (Map.Entry<String, Object> entry : transmitter.getAllPairs()) {
			Label label = new Label(entry.getKey() + " : " + entry.getValue());
			box.add(label);
		}

		for (Entry<String, ArrayList<ContentTransmitter>> list : transmitter.getAllLists()) {
			CaptionPanel caption = new CaptionPanel(list.getKey());
			box.add(caption);

			FlowPanel flow = new FlowPanel();
			caption.add(flow);

			for (ContentTransmitter t : list.getValue()) {
				Label label = new Label(t.toString());
				flow.add(label);
			}
		}
	}
}
